package com.yand.oratransmysql.utils;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * 时间类型处理类
 */
public class DateUtils {
    private static final String PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static String parseDate(Date date){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN);
        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zoneId);
        String dateStr = formatter.format(localDateTime);

        return dateStr;
    }



}
